import { createRouter, createWebHistory } from "vue-router";

import HomeView from '../views/HomeView.vue';
import NotFoundView from '../views/NotFoundView.vue';

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            name: 'index', // name尽量是唯一的，一旦重复容易找不到
            // redirect: '/Home'
            component: HomeView
        },
        {
            path: '/Home',
            name: 'home',
            component: HomeView
        },
        {
            path: '/About',
            name: 'about',
            component: () => import('../views/AboutView.vue')
        },
        {
            path: '/:pathMatch(.*)',
            name: '404',
            component: NotFoundView
        }
    ]
})

export default router